package xyz.zdsoft.attendance_manage_module.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.zdsoft.attendance_manage_module.bo.AttendanceInfoBo;
import xyz.zdsoft.attendance_manage_module.pojo.MyPage;
import xyz.zdsoft.attendance_manage_module.service.TeacherAttendanceService;
import xyz.zdsoft.attendance_manage_module.vo.AttendanceInfoVo;
import xyz.zdsoft.common.utils.Result;
import xyz.zdsoft.common.utils.ResultBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * @author 王林
 * @version 1.0
 * @date 2021-07-25 周日
 * @time 22:17
 * @description
 */
@Api(tags = "老师的考勤管理")
@RestController
@RequestMapping("/api/teacher/attendance")
public class TeacherAttendanceController {


    @Resource
    private TeacherAttendanceService teacherAttendanceService;

    @GetMapping(value = "/getAttendance")
    @ApiOperation(value = "老师查看与自己课程相关的项目考勤记录")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "startTime", value = "考勤日期时间段开始",
//                    dataType = "String"),
//            @ApiImplicitParam(name = "endTime", value = "考勤日期时间段结束",
//                    dataType = "String"),
//            @ApiImplicitParam(name = "lessonName", value = "项目名称",
//                    dataType = "String"),
//            @ApiImplicitParam(name = "type（1：正常，2：迟到，3：早退，4：缺勤，5：迟到又早退，6：请假）", value = "考勤情况",
//                    dataType = "String"),
//            @ApiImplicitParam(name = "pageNumber", value = "页码",
//                    required = true, dataType = "String"),
//            @ApiImplicitParam(name = "pageSize", value = "每页大小",
//                    required = true, dataType = "String"),
//    })
    public Result<AttendanceInfoVo> getAttendance(AttendanceInfoBo attendanceInfoBo, HttpServletRequest request) {

        return teacherAttendanceService.queryStudentAttendance(attendanceInfoBo,request);
    }


    @GetMapping(value = "/punchRecord")
    @ApiOperation(value = "查询学生个人打卡记录")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "startTime", value = "打卡日期(前)", dataType = "Date"),
//            @ApiImplicitParam(name = "endTime", value = "打卡日期(后)", dataType = "Date"),
//            @ApiImplicitParam(name = "pageNumber", value = "页码", required = true, dataType = "String"),
//            @ApiImplicitParam(name = "pageSize", value = "每页大小", required = true, dataType = "String"),
//    })
    public ResultBody getPunchRecord(HttpServletRequest request,
                                     @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
                                     @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, MyPage page) {

        String token = request.getHeader("token");
        return ResultBody.success();
    }

}
